#include "devicemanager.h"

CDeviceManager *CDeviceManager::getInstance()
{
    /**
     * @return CDeviceManager* A pointer to the instance of the object
     */
    static CDeviceManager s_instance;
    return &s_instance;
}

CDeviceManager::CDeviceManager()
    : m_nCheatMode(Constants::NO_CHEAT)
{
    /**
     * Constructor, initialise the cheats to no cheats.
     */
}

CDeviceManager::~CDeviceManager()
{
    /**
     * Release the D3D DeviceS
     */
    m_pDevice->Release();
    m_pDevice = nullptr;
}

LPDIRECT3DDEVICE9 CDeviceManager::getDevice() const
{
    /**
     * @return LPDIRECT3DDEVICE9 The D3D Device for the window context.
     */
    return m_pDevice;
}

void CDeviceManager::setDevice(LPDIRECT3DDEVICE9 pDevice)
{
    /**
     * @param LPDIRECT3DDEVICE9 pDevice The D3D Device for the  window context.
     */
    m_pDevice = pDevice;
}

int CDeviceManager::getCheatMode() const
{
    /**
     * @return CHEAT_MODE The current cheat mode.
     */
    return m_nCheatMode;
}

void CDeviceManager::setCheatMode(int nCheatMode)
{
    /**
     * @param CHEAT_MODE cheatMode the new cheat mode
     */
    m_nCheatMode = nCheatMode;
}